package haoyou.csnf.manager.module.pm.dal.mysql.employeetitles;

import java.util.*;

import haoyou.csnf.manager.framework.common.pojo.PageParam;
import haoyou.csnf.manager.framework.common.pojo.PageResult;
import haoyou.csnf.manager.framework.mybatis.core.query.LambdaQueryWrapperX;
import haoyou.csnf.manager.framework.mybatis.core.mapper.BaseMapperX;
import haoyou.csnf.manager.module.pm.dal.dataobject.employeetitles.EmployeeTitlesDO;
import org.apache.ibatis.annotations.Mapper;
import haoyou.csnf.manager.module.pm.controller.admin.employeetitles.vo.*;

/**
 * 职工职称 Mapper
 *
 * @author 好有经验源码
 */
@Mapper
public interface EmployeeTitlesMapper extends BaseMapperX<EmployeeTitlesDO> {

    default PageResult<EmployeeTitlesDO> selectPage(EmployeeTitlesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeTitlesDO>()
                .eqIfPresent(EmployeeTitlesDO::getEmpId, reqVO.getEmpId())
                .eqIfPresent(EmployeeTitlesDO::getTieId, reqVO.getTieId())
                .eqIfPresent(EmployeeTitlesDO::getCmpFlag, reqVO.getCmpFlag())
                .betweenIfPresent(EmployeeTitlesDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(EmployeeTitlesDO::getId));
    }
    default PageResult<EmployeeTitlesDO> selectPage(PageParam reqVO, Integer empId) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeTitlesDO>()
                .eq(EmployeeTitlesDO::getEmpId, empId)
                .orderByDesc(EmployeeTitlesDO::getId));
    }

    default int deleteByEmpId(Long empId) {
        return delete(EmployeeTitlesDO::getEmpId, empId);
    }

    default int deleteByEmpIds(List<Long> empIds) {
        return deleteBatch(EmployeeTitlesDO::getEmpId, empIds);
    }

}